UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i5CKoMs07511yaMS6lmw5qPjr7NyRgR70awW3Lm+k+8=' 
WHERE 
  key_id = 'aeaa55327b0cc8e204cc8d70c0768cc49b409ecc4b19b7f89b91950114f70ef8' 
  AND (
    token = 'i5CKoMs07511yaMS6lmw5qPjr7NyRgR70awW3Lm+k+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034