UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ISDP+jveZKRghB879gKi61Gd3ggy91QLlx5jKJ/EI/A=' 
WHERE 
  key_id = '7038c3054d423dd01fb26bc783fa69fd0da1f72bc91d834c7adaa8848b9f0766' 
  AND (
    token = 'ISDP+jveZKRghB879gKi61Gd3ggy91QLlx5jKJ/EI/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042