UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tyx/MM7amfGypEwRy6mLKRaqASkAbeOwhWMnHtsTRuo=' 
WHERE 
  key_id = '000d564f6fe1e4dd64d545435a13a381c8c50917faeef60495cbe1046b06f860' 
  AND (
    token = 'Tyx/MM7amfGypEwRy6mLKRaqASkAbeOwhWMnHtsTRuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051