UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aN6HvOP+5e5qUxyGvKFFhYg1ZBujolV1EyZ8Vsj1r8M=' 
WHERE 
  key_id = '5f560f1bd8582954c3380794450fba7ac4a4400318730ce6e1c1a4bcd1ff3011' 
  AND (
    token = 'aN6HvOP+5e5qUxyGvKFFhYg1ZBujolV1EyZ8Vsj1r8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027