UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c4LH5Yz05xkRuujmHQlULaO55L9C2jqWeaJGcScTOCg=' 
WHERE 
  key_id = 'e530b0e3e35839fd1a5c04f0dc4f280ca0e244930ddfbca207cbcd32e670450e' 
  AND (
    token = 'c4LH5Yz05xkRuujmHQlULaO55L9C2jqWeaJGcScTOCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052