UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dv+DHt/Qp0PcTqicHGo8/YDQbOXwo0T65/eRpcs0BMY=' 
WHERE 
  key_id = '01bdb144d52c0662c519cb832d3faf643d7c487086eccd028cb778827d99f477' 
  AND (
    token = 'dv+DHt/Qp0PcTqicHGo8/YDQbOXwo0T65/eRpcs0BMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069