UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bermCnFcOYZBwYqzRYjGjPGY+Wz+yt8PNcaesc9+7GQ=' 
WHERE 
  key_id = '9c1efd3a7ddd1f20c94231468a78b25e3fb0bb988baa06abd4deddc9b98d8dd6' 
  AND (
    token = 'bermCnFcOYZBwYqzRYjGjPGY+Wz+yt8PNcaesc9+7GQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041