UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZU1LPX6x7SOPHhu8Qha+3YwsgrDUy+ua/mz/yMixDSc=' 
WHERE 
  key_id = 'cb30c9b218aa157674932c7413698c35c99ef30960c018e9d5a37047ee55022a' 
  AND (
    token = 'ZU1LPX6x7SOPHhu8Qha+3YwsgrDUy+ua/mz/yMixDSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040