UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5vKaoWLq5hHjyFieRMwd93/opqGVFUzAPkwGlrtnMOA=' 
WHERE 
  key_id = '5f6c76f98a4fd87b9f7a54d195267529db91486d431d3f6d413f4daaed5627d6' 
  AND (
    token = '5vKaoWLq5hHjyFieRMwd93/opqGVFUzAPkwGlrtnMOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045