UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4IavCg0QqavSZOk+cw8Zwsp6/YlqxsHemYbuvA8zOV8=' 
WHERE 
  key_id = '3f5a246c67fb51cb68b07a7f238332cf05593c5557b5740613894d35a6739a28' 
  AND (
    token = '4IavCg0QqavSZOk+cw8Zwsp6/YlqxsHemYbuvA8zOV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018