UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8lcU6rMYRJWbdjI1EgxigIvP32+5HTFHhssRkvdgg0=' 
WHERE 
  key_id = 'b052a5c793cdb9b475ddf9c54b839b21f0e49360c7299283a5f845b8731114ef' 
  AND (
    token = 'W8lcU6rMYRJWbdjI1EgxigIvP32+5HTFHhssRkvdgg0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027