UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xo/mOgpp35BZziRaGzthkbcvEUoyc1cZWT2YlaNURsU=' 
WHERE 
  key_id = '354b24b1a3f288f8f7680a6bb7b45c20b6402b662c3611613317d9c9da949129' 
  AND (
    token = 'Xo/mOgpp35BZziRaGzthkbcvEUoyc1cZWT2YlaNURsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038