UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '51FYJIJ3P4xUE5NfAJKT3C7A7KaTvZm5zxAGpJ+fQvE=' 
WHERE 
  key_id = '954654e83010d9acc69c3371ca715c0e55ac264ae3dff06e74b1bc37824019e1' 
  AND (
    token = '51FYJIJ3P4xUE5NfAJKT3C7A7KaTvZm5zxAGpJ+fQvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029