UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aiSt0j7+BH0KnGKIhQ/72DkaSQxNAX8les1RfaQKIcU=' 
WHERE 
  key_id = '42ac0c0eafe30ddff65c2b0bdda8811338855d174a94694b3e2554d247dd4cab' 
  AND (
    token = 'aiSt0j7+BH0KnGKIhQ/72DkaSQxNAX8les1RfaQKIcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036