UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4krup5qFDt3Tqlhj0kA79XN/AENLNn2L1ZLICAOKr/I=' 
WHERE 
  key_id = 'c57a622325c01f73aaf524579f391089d59dc8075fae776f802b6ec70ea22395' 
  AND (
    token = '4krup5qFDt3Tqlhj0kA79XN/AENLNn2L1ZLICAOKr/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032