UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hqq4Ck64cJeBxcnZsbHOsMJk7HBny0izstZpfKuV7Yk=' 
WHERE 
  key_id = '42ccc4ad09dab18a0deb9c0b8be403788e810e40f65ca9c58e82949de8cedded' 
  AND (
    token = 'Hqq4Ck64cJeBxcnZsbHOsMJk7HBny0izstZpfKuV7Yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00104