UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ofVZ8YcucHRF/p0S3QeERUgn9TGPk8t/u4kZoDtSezo=' 
WHERE 
  key_id = 'ddb71d33038df74d29013f72bd79a500b2000536b024459428b0df14565357cb' 
  AND (
    token = 'ofVZ8YcucHRF/p0S3QeERUgn9TGPk8t/u4kZoDtSezo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048