UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qc6ClQ/762tkifJDeXYbGnNQVpRXAgI3cIAzNKViG/4=' 
WHERE 
  key_id = '376c8e45a041f6907fe3d7e88b64efc336f885596f9f183d340fedd4cbc8f520' 
  AND (
    token = 'Qc6ClQ/762tkifJDeXYbGnNQVpRXAgI3cIAzNKViG/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028