UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RhtLZolrS6Q8OUzVXqtKph7pr7egPB12hmtEntbrvj4=' 
WHERE 
  key_id = 'e3d2f8067151717b28c7135b90a1428849b2a3c4d4733136e50446e410c76495' 
  AND (
    token = 'RhtLZolrS6Q8OUzVXqtKph7pr7egPB12hmtEntbrvj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034