UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vsqBXy4z5LMn4L4GaFUU7g5wgfLL6t4SCi9+2OB/K0k=' 
WHERE 
  key_id = '852e71db2edc9967923b50dbcc70bd9a0148d032e02f1ddb5cefd6061c7434bb' 
  AND (
    token = 'vsqBXy4z5LMn4L4GaFUU7g5wgfLL6t4SCi9+2OB/K0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032