UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XnzKMJLufinAXmX/wLVizEdzlGLwmoY8PZQkwNnrgss=' 
WHERE 
  key_id = 'e60e3e0117a4574b5ad7bdae6e70bb5aedd8a6f847f62475e2d6195aee144f77' 
  AND (
    token = 'XnzKMJLufinAXmX/wLVizEdzlGLwmoY8PZQkwNnrgss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043