UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FEUEij+WhHMUuPljR8NujMKZVLABov92+2lge5ZDv+0=' 
WHERE 
  key_id = '4080c080f1523677adf2c25597fe5a32d3f1143faed4c0d3a95e8bb9dab69573' 
  AND (
    token = 'FEUEij+WhHMUuPljR8NujMKZVLABov92+2lge5ZDv+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024