UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KrI9xlqVwRbOMcp7EvCel31JCZcZ4VrEvaV4DdFQ6mc=' 
WHERE 
  key_id = '8bd27d098f05a3b3c50e5e3ebcaf6015ed7e339bf746a3aceb7824a175abb1fe' 
  AND (
    token = 'KrI9xlqVwRbOMcp7EvCel31JCZcZ4VrEvaV4DdFQ6mc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030