UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Juemj9jzOdzvz0NBTXuJ7MfSlPkAN+tzUwLgNJGmEvk=' 
WHERE 
  key_id = '64c99bd857ce8bc1adc526c9ed25f7036d32f3608da501223fdf4981a9332955' 
  AND (
    token = 'Juemj9jzOdzvz0NBTXuJ7MfSlPkAN+tzUwLgNJGmEvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051