UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXRVufuqG0uw15+iQuRyV4APhv8h+xqIXj89876d6Tw=' 
WHERE 
  key_id = '825b6d8e411d21e7c3a1b97ca2d101db7f3f59fcbe7eefa1b766346f3c619e03' 
  AND (
    token = 'fXRVufuqG0uw15+iQuRyV4APhv8h+xqIXj89876d6Tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037