UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hqaG/gI/JrdYwxV9i0fP0NJjfe3hCRJdFnSAftQyPXc=' 
WHERE 
  key_id = '975f111ac95779f85e09fdf294adc1f891f615d4a4be691bfeaa82ed5a1c507f' 
  AND (
    token = 'hqaG/gI/JrdYwxV9i0fP0NJjfe3hCRJdFnSAftQyPXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032