UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vAnUbAtA6OnlnsyH1nnl4QR+LdU0kAhI8HmyD1+nVDg=' 
WHERE 
  key_id = '8a399e000717cef90553f0ff6269511e88841e1d9f6ff562314464237de39899' 
  AND (
    token = 'vAnUbAtA6OnlnsyH1nnl4QR+LdU0kAhI8HmyD1+nVDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028