UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WEdJB0FzQ6quJGjk7J0oleKkk1SUKsc+3QMoJUmoyyc=' 
WHERE 
  key_id = '80a97b83ed1e486aae9e422f4f1a40fceafc073ef77bf96dc4fc61a43747158f' 
  AND (
    token = 'WEdJB0FzQ6quJGjk7J0oleKkk1SUKsc+3QMoJUmoyyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046