UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DZXOxGIT9kv3obAGTImvDGpeuVjUSFc2a4Lbyb7ligw=' 
WHERE 
  key_id = '26023c38b43af350363aaec01eea7b5b71469b9ef5d1c190bafabaf320c88934' 
  AND (
    token = 'DZXOxGIT9kv3obAGTImvDGpeuVjUSFc2a4Lbyb7ligw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032