UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G8BjFN1UG4GjfKovJecSUyEug9VGN474EVTOB0g82F8=' 
WHERE 
  key_id = '932bf3b77ba8af1542d84eec225f9317d8fa0833c50ad2d731d04518ebf28978' 
  AND (
    token = 'G8BjFN1UG4GjfKovJecSUyEug9VGN474EVTOB0g82F8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080