UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OFeVNUF8jzN59Atdwl9xovzgSJ0Zp9m4QeKA3vU2PZE=' 
WHERE 
  key_id = '166a0ef3106817061ba198249ba46d14c6a4f9515a8ff2aed3be6eba8c7e9c9c' 
  AND (
    token = 'OFeVNUF8jzN59Atdwl9xovzgSJ0Zp9m4QeKA3vU2PZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039