UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QPjoE4LvbR7+6mnqYhcAi1oJQGCCavjutXdlnfmXfu0=' 
WHERE 
  key_id = '1b101288375474e4bf51c9246499bdb4ce79388b781fdc791826a6ea27a69a4a' 
  AND (
    token = 'QPjoE4LvbR7+6mnqYhcAi1oJQGCCavjutXdlnfmXfu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025