UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'irtd6afuhXfRCG6PkuNu29qqmFB13lcd8K+kKa0WbUA=' 
WHERE 
  key_id = '5206adeaaaf93e8716dbe7649fe48f4f2e04fc9a99b295227ec13b95f3721622' 
  AND (
    token = 'irtd6afuhXfRCG6PkuNu29qqmFB13lcd8K+kKa0WbUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034