UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iUvtQeFWJrnfFdCg+8q+5t4cCobI4ygmiQm/Zeom2Jk=' 
WHERE 
  key_id = '2b82bc181d407b025961f94f2e06c34effff3a1311641563b5a47570a54fb457' 
  AND (
    token = 'iUvtQeFWJrnfFdCg+8q+5t4cCobI4ygmiQm/Zeom2Jk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031