UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CZkI8YTBuJu7Me3rLIea2XgKau6rEkbl7mBEJdHh3vM=' 
WHERE 
  key_id = '9e139ea3001a94156328c34285f5208e20657d3a59918a8fdef236fd2f7ce406' 
  AND (
    token = 'CZkI8YTBuJu7Me3rLIea2XgKau6rEkbl7mBEJdHh3vM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026