UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S1reLhqBbs85AdicRev5FPzXM1IIZnnzCmuEIIiCqmg=' 
WHERE 
  key_id = '3222bdbf4b76be69f5ec5cd4b342d01c3fdeab41c075189e3bc06aa4aafaa644' 
  AND (
    token = 'S1reLhqBbs85AdicRev5FPzXM1IIZnnzCmuEIIiCqmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046