UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qXK7C6HSJGx6NJgaTh7Gpd0CwjG0xgVIGtBfJtXIskA=' 
WHERE 
  key_id = '0b097249f38b50d64a15316affad3d2b85f7311a15954ceb0b030dd255c6ac5f' 
  AND (
    token = 'qXK7C6HSJGx6NJgaTh7Gpd0CwjG0xgVIGtBfJtXIskA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023