UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X1W8eJY/OTEUMNrZ74o/i8pMGshvW9JJsPEJi9Tgv34=' 
WHERE 
  key_id = '9595d8f140016f8c4b6c82917e4e3adbcef3ff68a0e72114ed42e788eac91003' 
  AND (
    token = 'X1W8eJY/OTEUMNrZ74o/i8pMGshvW9JJsPEJi9Tgv34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031