UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gA5UKh7KlKCSUEr1D4Bvq+QkJkCkq5MUmS9QTEPLo+w=' 
WHERE 
  key_id = '0e42681cae73afa0861327da1518bb8223ac04854d78b5be7a0104ec5cc2f7f6' 
  AND (
    token = 'gA5UKh7KlKCSUEr1D4Bvq+QkJkCkq5MUmS9QTEPLo+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021