UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JDS7ANt0ggRJgARTVSg1MJhoqV+5zzcei0oe72lNNmE=' 
WHERE 
  key_id = '395a7b97ac09fabff3837c8ef16cc77560d1a91b9cb4a8b4b3bfc8587bbb5639' 
  AND (
    token = 'JDS7ANt0ggRJgARTVSg1MJhoqV+5zzcei0oe72lNNmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00124